<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="PatchSchema"
                  targetNamespace="http://www.codeplex.com/schema/PatchSchema-1.0.xsd"
                  elementFormDefault="qualified"
                  xmlns="http://www.codeplex.com/schema/PatchSchema-1.0.xsd"
                  xmlns:mstns="http://www.codeplex.com/schema/PatchSchema-1.0.xsd"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="PatchElement">
    <xs:sequence>
      <xs:element name="delete" type="DeleteElement" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="update" type="UpdateElement" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="add" type="AddElement" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="ItemTypeElement">
    <xs:restriction base="xs:string">
      <xs:enumeration value="folder"/>
      <xs:enumeration value="file"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="CompressionTypeElement">
    <xs:restriction base="xs:string">
      <xs:enumeration value="none"/>
      <xs:enumeration value="deflate"/>
      <xs:enumeration value="gzip"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="DeleteElement">
    <xs:attribute name="path" type="xs:string" use="required"/>
    <xs:attribute name="csid" type="xs:int" use="required"/>
    <xs:attribute name="type" type="ItemTypeElement" use="required"/>
  </xs:complexType>

  <xs:complexType name="UpdateElement">
    <xs:simpleContent>
      <xs:extension base="xs:base64Binary">
        <xs:attribute name="path" type="xs:string" use="required"/>
        <xs:attribute name="csid" type="xs:int" use="required"/>
        <xs:attribute name="compression" type="CompressionTypeElement" default="none"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="AddElement">
    <xs:simpleContent>
      <xs:extension base="xs:base64Binary">
        <xs:attribute name="path" type="xs:string" use="required"/>
        <xs:attribute name="type" type="ItemTypeElement" use="required"/>
        <xs:attribute name="compression" type="CompressionTypeElement" default="none"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element type="PatchElement" name="patch"/>

</xs:schema>
